/**
 * 
 */
package sv.gob.mh.dgii.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author melvin.henriquez
 * 
 */
@Entity
@Table(name = "GO_GESTION", schema = "GESOMISOS")
public class GoGestion implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6679026857168770377L;
	private String cgestion;
	private String dgestion;
	private Date fhInicio;
	private Date fhFin;
	private String cusuario;
	private Integer precierre;
	private Set<GoCaso> goCasos = new HashSet<GoCaso>(0);
	private Set<GoCasoTecnicoGestion> goCasoTecnicoGestions = new HashSet<GoCasoTecnicoGestion>(
			0);

	public GoGestion() {

	}

	public GoGestion(String cgestion, String dgestion, String cusuario) {
		this.cgestion = cgestion;
		this.dgestion = dgestion;
		this.cusuario = cusuario;
	}

	public GoGestion(String cgestion, String dgestion, Date fhInicio,
			Date fhFin, String cusuario, Integer precierre) {
		this.cgestion = cgestion;
		this.dgestion = dgestion;
		this.fhInicio = fhInicio;
		this.fhFin = fhFin;
		this.cusuario = cusuario;
		this.precierre = precierre;
	}

	/**
	 * @return the cgestion
	 */
	@Id
	@Column(name = "C_GESTION", unique = true, nullable = false, length = 2)
	public String getCgestion() {
		return cgestion;
	}

	/**
	 * @param cgestion
	 *            the cgestion to set
	 */
	public void setCgestion(String cgestion) {
		this.cgestion = cgestion;
	}

	/**
	 * @return the dgestion
	 */
	@Column(name = "D_GESTION", nullable = false, length = 30)
	public String getDgestion() {
		return dgestion;
	}

	/**
	 * @param dgestion
	 *            the dgestion to set
	 */
	public void setDgestion(String dgestion) {
		this.dgestion = dgestion;
	}

	/**
	 * @return the fhInicio
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_INICIO", length = 7)
	public Date getFhInicio() {
		return fhInicio;
	}

	/**
	 * @param fhInicio
	 *            the fhInicio to set
	 */
	public void setFhInicio(Date fhInicio) {
		this.fhInicio = fhInicio;
	}

	/**
	 * @return the fhFin
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_FIN", length = 7)
	public Date getFhFin() {
		return fhFin;
	}

	/**
	 * @param fhFin
	 *            the fhFin to set
	 */
	public void setFhFin(Date fhFin) {
		this.fhFin = fhFin;
	}

	/**
	 * @return the cusuario
	 */
	@Column(name = "C_USUARIO", nullable = false, length = 30)
	public String getCusuario() {
		return cusuario;
	}

	/**
	 * @param cusuario
	 *            the cusuario to set
	 */
	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	/**
	 * @return the precierre
	 */
	@Column(name = "PRE_CIERRE", nullable = false, precision = 1, scale = 0)
	public Integer getPrecierre() {
		return precierre;
	}

	/**
	 * @param precierre
	 *            the precierre to set
	 */
	public void setPrecierre(Integer precierre) {
		this.precierre = precierre;
	}

	/**
	 * @return the goCasos
	 */
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "goGestion")
	public Set<GoCaso> getGoCasos() {
		return goCasos;
	}

	/**
	 * @param goCasos the goCasos to set
	 */
	public void setGoCasos(Set<GoCaso> goCasos) {
		this.goCasos = goCasos;
	}

	/**
	 * @return the goCasoTecnicoGestions
	 */
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "goGestion")
	public Set<GoCasoTecnicoGestion> getGoCasoTecnicoGestions() {
		return goCasoTecnicoGestions;
	}

	/**
	 * @param goCasoTecnicoGestions
	 *            the goCasoTecnicoGestions to set
	 */
	public void setGoCasoTecnicoGestions(
			Set<GoCasoTecnicoGestion> goCasoTecnicoGestions) {
		this.goCasoTecnicoGestions = goCasoTecnicoGestions;
	}

}
